<html>
<head>
	<?php $this->load->view('config/head');?>
</head>
<body>
	<?php $this->load->view('config/awal_body');?>
	
	<h3>List image</h3>
	<a href="<?php echo site_url()?>mg_image/add" class="btn">Create image</a>
	<br/>
	<br/>
	
	<?php $success = $this->session->flashdata('success');?>
	<?php if ($success):?>
		<div class="alert alert-success">
			Data telah tersimpan
		</div>
	<?php endif?>
	
	<?php $error = $this->session->flashdata('error');?>
	<?php if ($error):?>
		<div class="alert alert-info">
			<b>Data gambar gagal tersimpan</b>, Data gambar melebihi ukuran yang ada
		</div>
	<?php endif?>
	
	<?php $delete = $this->session->flashdata('delete');?>
	<?php if ($delete):?>
		<div class="alert alert-success">
			Data telah terhapus
		</div>
	<?php endif?>
	
	<?php $delete = $this->session->flashdata('deleteImage');?>
	<?php if ($delete):?>
		<div class="alert alert-success">
			Data gambar telah terhapus
		</div>
	<?php endif?>
	
	<?php if (@$results):?>
	<table width="100%" class="table table-hover ">
		<tr>
			<th>Detail</th>
			<th>Place image</th>
			<th>Description image</th>
			<th>Action</th>
		</tr>
		<?php foreach ($results as $row):?>
		<tr>
			<td width="2%">
				<a href="<?php echo site_url()?>upload/picture/<?php echo $row['upload_image'];?>" class="icon-picture" data-lightbox="image-galeri" title="<?php echo $row['deskripsi_image']?>"></a>
			</td>
			<td>
				<?php if($row['jenis_image'] == "1"):?>
					Logo
				<?php elseif($row['jenis_image'] == "2"):?>
					Slide Show
				<?php elseif($row['jenis_image'] == "3"):?>
					Galery
				<?php endif;?>
			</td>
			<td><?php echo $row['deskripsi_image']?></td>
			<td align="center">
				<a href="<?php echo site_url()?>mg_image/edit/<?php echo $row['id_image']?>" class="icon-edit" title="Edit"></a> &nbsp; 
				<a href="<?php echo site_url()?>mg_image/deleteImage/<?php echo $row['id_image']?>" class="icon-remove-circle" title="Delete Image" onClick="return confirm('Anda yakin akan menghapus data ini?');"></a>  &nbsp; 
				<a href="<?php echo site_url()?>mg_image/delete/<?php echo $row['id_image']?>" class="icon-trash" title="Delete Data" onClick="return confirm('Anda yakin akan menghapus data ini?');"></a>
			</td>
		</tr>
		<?php endforeach?>
	</table>
	<?php else:?>
		<div class="alert alert-error">
			Not found data
		</div>
	<?php endif?>

	<?php $this->load->view('config/akhir_body');?>
</body>
</html>
